﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TankIt.Models.Games.HoldEm
{
    public class PocketCards
    {
        private const int PocketMask = 0xFFF; //Bitmask 111111 111111 (4095)

        public int PocketNumber;

        public PocketCards(Card card1, Card card2) : this(new List<Card>() { card1, card2 }) { }

        public PocketCards(List<Card> cards)
        {
            if (cards.Count > 2)
                throw new ArgumentOutOfRangeException("Too many cards, for pocket");

            int card1number = 0;
            int card2number = 0;

            foreach (var card in cards)
            {
                
                if ((cards.IndexOf(card)) % 1 == 0)
                {
                    card1number = card.GetCardNumber();
                }
                else
                {
                    card2number = card.GetCardNumber();
                }

            }
            this.PocketNumber = (card1number << 6) & card2number;
        }

        public int GetPocketNumber()
        {
            return PocketNumber;
        }
    }
}